//
//  File.swift
//
//
//  Created by didi on 2022/9/14.
//

import Foundation
import MolecularObjects

public extension Web {
    enum Page: ObjectModel {
        public typealias Module = Web
    }
}

public extension Web.Page {
    // MARK: -

    struct List: Codable {
        public let id: UUID
        public let title: String
        public let metadata: Metadata

        public init(id: UUID,
                    title: String,
                    metadata: Metadata) {
            self.id = id
            self.title = title
            self.metadata = metadata
        }
    }

    // MARK: -

    struct Detail: Codable {
        public let id: UUID
        public let title: String
        public let content: String
        public let metadata: Metadata

        public init(id: UUID,
                    title: String,
                    content: String,
                    metadata: Metadata) {
            self.id = id
            self.title = title
            self.content = content
            self.metadata = metadata
        }
    }

    // MARK: -

    struct Create: Codable {
        public let title: String
        public let content: String

        public init(title: String,
                    content: String) {
            self.title = title
            self.content = content
        }
    }

    // MARK: -

    struct Update: Codable {
        public let title: String
        public let content: String

        public init(title: String,
                    content: String) {
            self.title = title
            self.content = content
        }
    }

    // MARK: -

    struct Patch: Codable {
        public let title: String?
        public let content: String?

        public init(title: String? = nil,
                    content: String? = nil) {
            self.title = title
            self.content = content
        }
    }
}
